package md.frolov.bible.commands;

import java.util.Map;

import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.commands.IHandler;
import org.eclipse.core.commands.State;
import org.eclipse.jface.menus.IMenuStateIds;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.commands.ICommandService;
import org.eclipse.ui.commands.IElementUpdater;
import org.eclipse.ui.menus.UIElement;

public class ToggleStrongNumbers extends AbstractHandler implements IHandler{

	public static final String COMMAND_ID = "md.frolov.bible.commands.ToggleStrongNumbers";
	public static final String TOGGLE_STATE_ID = "md.frolov.bible.strong.toggleState";
	
	@Override
	public Object execute(ExecutionEvent event) throws ExecutionException {
//		ICommandService comService = (ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class);
//		State state = comService.getCommand(COMMAND_ID).getState(TOGGLE_STATE_ID);
//		state.setValue(!(Boolean)state.getValue());
//		comService.refreshElements(event.getCommand().getId(), null);
		
		State state = event.getCommand().getState(IMenuStateIds.STYLE);
		System.out.println(state.getValue());
		return null;
	}

//	@Override
//	public void updateElement(UIElement element, Map parameters) {
//		ICommandService comService = (ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class);
//		State state = comService.getCommand(COMMAND_ID).getState(TOGGLE_STATE_ID);
//		element.setChecked((Boolean)state.getValue());
//	}

}
